package chapter21.section3;

/**
 * Created by lzy
 * Date: 2018/6/4
 */
public class SerialNumberGenerator {
    private static volatile int serialNumber = 0;

    public static synchronized int nextSerialNumber() {
        // not thread-safe
        return serialNumber++;
    }
}
